/* YHELLO.CPP
  This is a simple example of deriving from TFrameWindow;
  we override the mouse_move() method, update the status
  bar text with the coordinates, and draw the mouse points.
  TClientDC is derived from TDC, and ensures that the device
  context is properly attached and released.
*/

#include <yawl.h>
class TClientDC: public TDC {
public:
   TClientDC(TWin* w)
    {  
      set_twin(w);
      get();
    }

    ~TClientDC()
    {
       release();
    }
};

class MyWindow: public TFrameWindow {
public:
  MyWindow()
   {
     set_text("hello");
     set_background(1,1,1);
   }

  // override TEventWindow's mouse_move()
   void mouse_move(Point& pt)
   {
     char buff[100];
     sprintf(buff,"%d %d",pt.x,pt.y);
     set_status_text(0,buff);
     TClientDC dc(this);
     dc.line_to(pt.x,pt.y);
   }

};

MyWindow *w;
int main(int argc, char**argv)
{
  w = new MyWindow();
  w->show();
  w->run();
  return 0;
}
